home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / a_utils / decomp.lha / decomp / vartab.h < prev   
C/C++ Source or Header  |  1988-01-12  |  3KB  |  106 lines

  1. /*
  2.  * Module: vartab.h
  3.  *
  4.  * Author: J. Reuter
  5.  *
  6.  * This file contains data structures and constants used by vartab.c,
  7.  * responsible for all decompiler internal symbol management.
  8.  */
  9.  
  10. /*
  11.  * types
  12.  *
  13.  * These types attributes are attached to all internal variable
  14.  * information.  The type is used to generate suffexes for generated
  15.  * names, and to infer type conversions.
  16.  *
  17.  * The TYP* constants are defined in ops.h.  Sources files including
  18.  * this file must first include ops.h.
  19.  */
  20. #define T_CHAR TYPB
  21. #define T_SHORT TYPW
  22. #define T_LONG TYPL
  23. #define T_FLOAT TYPF
  24. #define T_DOUBLE TYPD
  25. #define T_FUNC TYPS
  26.  
  27. /*
  28.  * the following constants must be powers of two (bits) and must be
  29.  * distinct from the above type values
  30.  */
  31.  
  32. /* type modifiers */
  33. #define T_UNSIGNED 1
  34. #define T_POINTER 16
  35.  
  36. /*
  37.  * classes
  38.  *
  39.  * These are the storage classes of static information.  They are used
  40.  * to determine variable scoping (residence).
  41.  */
  42. #define C_TEXT 0
  43. #define C_DATA 8
  44. #define C_BSS 16
  45.  
  46. /*
  47.  * class modifiers
  48.  *
  49.  * C_WRITTEN is set for variables that are written.  It is or'ed with
  50.  * T_UNSIGNED in the flag part of the tables, so the bits used must not
  51.  * conflict.
  52.  * C_STATIC is set for variables that have no global symbol table entry.
  53.  */
  54. #define C_WRITTEN 2
  55. #define C_STATIC 4
  56.  
  57. /*
  58.  * variable table structures
  59.  *
  60.  * The following structures store variable information in chains kept
  61.  * sorted by 'address'.
  62.  */
  63.  
  64. /*
  65.  * regtype is used to store register, local, and argument information.
  66.  */
  67. struct regtype {
  68.     int v_address;        /* register number */
  69.     int type;            /* variable type */
  70.     int flag;            /* C_WRITTEN, T_UNSIGNED */
  71.     struct regtype *next;    /* pointer to next regtype entry */
  72. };
  73.  
  74. /*
  75.  * inttype stores private (static global) variables
  76.  */
  77. struct inttype {
  78.     address v_address;        /* address of variable */
  79.     int type;            /* variable type */
  80.     int flag;            /* C_WRITTEN, T_UNSIGNED */
  81.     int class;            /* variable class and modifiers */
  82.     int symbolnum;        /* symbolnum from symbol table */
  83.     char *value_ptr;        /* internal address of initialized value */
  84.     struct inttype *next;    /* pointer to next entry */
  85. };
  86.  
  87. /*
  88.  * exttype stores public (external) variables.
  89.  */
  90. struct exttype {
  91.     unsigned int symnum;    /* symbol number from symbol table */
  92.     int type;            /* variable type */
  93.     int offset;            /* operand displacement value */
  94.     int flag;            /* C_WRITTEN, T_UNSIGNED */
  95.     struct exttype *next;    /* pointer to next entry */
  96. };
  97.  
  98. /*
  99.  * declare the function types
  100.  */
  101. extern char *reg_sym();
  102. extern char *loc_sym();
  103. extern char *arg_sym();
  104. extern char *int_sym();
  105. extern char *ext_sym();
  106.